#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N=1e5+10;

struct node{
    int x,id;
}a[N];
bool cmp(node f,node g){
    return f.x>g.x;
}
int n;

int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i].x,a[i].id=i;
    sort(a+1,a+n+1,cmp);
    int ans=n;
    for(int i=n;i>=1;i--){
        if(a[i].x==a[ans].x) continue;
        ans--;
    }
    cout<<ans;
    return 0;
}
